<?php
require_once('pgb/Client/Realization.php');

function realizationOutOffDate(){ 	
  	$candidates=Client_Realization::checkRealisationCandidates();
	
	$date3Months  = strtotime(date("Y-m-d") . " - 3 months");
	$date3Months=strtotime(date("Y-m-d",$date3Months));
	$today=date("Y-m-d");
  	foreach($candidates as $nr => $icand){
  		$day=strtotime($candidates[$nr]['max_date']);
  		$realId=$candidates[$nr]['realization_id'];
  		if($date3Months>$day){
  			Client_Realization::setRealisationOutOffDate($realId, $today);
  		}
  	}
  	
  	$realisationNoCandidates=Client_Realization::getRealisationNoCandidates();
  	foreach($realisationNoCandidates as $nr => $realization){
  		$day=strtotime($realisationNoCandidates[$nr]['data1']);
  		$realId=$realisationNoCandidates[$nr]['id'];
  		
  		if($date3Months>$day){
  			Client_Realization::setRealisationOutOffDate($realId, $today);
  		}
  	}
  	
}